package com.mycompany.tableOpe.controller;

import com.mycompany.mvc.utils.BaseResult;
import com.mycompany.tableOpe.entity.TableOpeBean;
import com.mycompany.tableOpe.service.TableOpeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;

/**
 * Created by Administrator on 2017/9/1 0001.
 */

@Controller
public class TableOpeAction {
    /**
     * App 添加数据
     * @return BaseResult
     */
    @Autowired
    TableOpeService tableOpeService;

    @RequestMapping(value ="/user/appAddTable" ,method = RequestMethod.POST)
    @ResponseBody
    public BaseResult appAddTable(@RequestBody  TableOpeBean tableOpeBean){
        return tableOpeService.addTable(tableOpeBean);
    }


    /**
     * 专家 更新数据
     * @return BaseResult
     */
    @RequestMapping(value ="/user/expUpdateTable" ,method = RequestMethod.POST)
    @ResponseBody
    public BaseResult expUpdateTable(@RequestBody TableOpeBean tableOpeBean){
        return  tableOpeService.updateTable(tableOpeBean);
    }

    /**
     * APP或专家  获取所有数据
     * @return BaseResult
     */
    @RequestMapping(value ="/user/getAllTable" ,method = RequestMethod.POST)
    @ResponseBody
    public BaseResult getAllTable(){
        return tableOpeService.getAllTable();
    }

}
